package com.dyw.blog.controller;

import com.dyw.blog.service.TagService;
import com.dyw.blog.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Devil
 * @create 2022-02-10 20:50
 */

@RestController
@RequestMapping("/tags")
public class TagController {

    @Autowired
     private TagService tagService;

    @GetMapping("/hot")
    public Result hot(){
        int limit  = 6;
        return tagService.findsHots(limit);
    }

    @GetMapping
    public Result findAll(){
        return tagService.findAll();
    }
    @GetMapping("detail")
    public Result findAllDetail(){
        return tagService.findAllDetail();
    }

    @GetMapping("detail/{id}")
    public Result findTagDetailById(@PathVariable("id")Long id){
        return tagService.findTagDetailById(id);
    }
}
